package com.emip.security;

import java.io.IOException;     
import java.io.PrintWriter;     
     
import javax.servlet.ServletException;     
import javax.servlet.http.HttpServlet;     
import javax.servlet.http.HttpServletRequest;     
import javax.servlet.http.HttpServletResponse;     
     
public class ResultServlet extends HttpServlet {     
    private static final long serialVersionUID = 1L;   
  
    public void doGet(HttpServletRequest request, HttpServletResponse response)     
            throws ServletException, IOException {     
     
        doPost(request, response);     
    }     
    public void doPost(HttpServletRequest request, HttpServletResponse response)     
            throws ServletException, IOException {     
     
        response.setContentType("text/html;charset=utf-8");     
        String validateC = (String) request.getSession().getAttribute("validateCode");     
        String veryCode = request.getParameter("c");     
        PrintWriter out = response.getWriter();     
        if(veryCode==null||"".equals(veryCode)){     
            //out.println("<script type='text/javascript'>alert('验证码为空!');return false;</script>");
        	out.print("CertNull");
        }else{     
            if(validateC.equals(veryCode)){   
            	out.print("CertSuccess");
            }else{     
                //out.println("<script type='text/javascript'>alert('验证码错误!');return false;</script>");    
            	out.print("CertError");
            }     
        }  
        out.flush();     
        out.close();     
    }     
     
} 